'''
Created on 22/04/2010

@author: Publico
'''

class MyPriority(object):
    '''
    classdocs
    '''


    def __init__(self, aQueue):
        self.readyQueue=aQueue
    
    def nextProgram(self, pes):
        size = self.readyQueue.qsize()
        higher = self.readyQueue.get()  #separo el primero        
        for i in range(size-1): 
            x = self.readyQueue.get()
            if (x.getPriority() < higher.getPriority()):
                self.readyQueue.put(higher)
                higher = x
            else:
                self.readyQueue.put(x)
        return higher
